RAILS_ROOT='.'
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
require 'rake'
require 'rake/clean'
require 'rake/testtask'
require 'rake/rdoctask'
require 'tasks/rails'

#clean the temp files
CLEAN.include('tmp/cache/*.*')
CLEAN.include('tmp/sessions/ruby_sess.*')
#include the necessary ruby files
SRC_RB = FileList['lib/**/*.rb']

desc "Run all the test......."

task :default => :test_all

desc 'Test everythings'
task :test_all do
  Rake::Task["test:units"].invoke       rescue got_error = true
  Rake::Task["test:functionals"].invoke rescue got_error = true
  
  if File.exist?("test/integration")
    Rake::Task["test:integration"].invoke rescue got_error = true
  end

  raise "Test failures" if got_error
end

desc 'Test all units'
task :test_unit do
  Rake::Task["test:units"].invoke       rescue got_error = true
  raise "Test failures" if got_error
end

desc 'Run all the functional test'
task :test_functional do
  funcTask = Rake::Task["test:functionals"]
  funcTask.invoke rescue got_error = true
  raise "Test failures" if got_error
end

desc 'Run all the integration test'
task :test_integration do
  if File.exist?("test/integration")
    Rake::Task["test:integration"].invoke rescue got_error = true
  end

  raise "Test failures" if got_error
end


#Rake::TestTask.new(:test_all) do |t|
#  t.test_files = FileList[
#    'test/acceptance/*_test.rb',
#  ]
#  t.warning = true
#  t.verbose = true
#end

